/*
 * @Description: 日志 - 操作日志
 * @Author: Rfan
 * @Date: 2022-09-20 15:34:08
 * @LastEditTime: 2023-01-19 10:51:25
 */

import { Key } from 'react';
import { logRequest } from '@/utils/request';
import { IPageQuery } from '@/interfaces/global';

// 列表请求参数
export interface IOperateLogParams {
  basePath?: string;
  description?: string;
  ip?: string;
  method?: string;
  operateTime?: string;
  parameter?: string;
  result?: string;
  spendTime?: number;
  uri?: string;
  url?: string;
  userName?: string;
}

// 列表返回数据
export interface IOperateLogRes {
  basePath: string;
  description: string;
  id: number;
  ip: string;
  method: string;
  operateTime: string;
  parameter: string;
  result: string;
  spendTime: number;
  uri: string;
  url: string;
  userName: string;
}

// 分页查询列表
export function fetchOperateLogListByPage(data: IPageQuery<IOperateLogParams>) {
  return logRequest({
    url: `/operate-log/page`,
    method: 'post',
    data
  });
}

// 删除日志
export function deleteOperateLog(id: Key) {
  return logRequest({
    url: `/operate-log/{id}`,
    method: 'delete'
  });
}
